<?
#This following code send a notification “[user-run-this-code] has done something nasty!” to the user whose uid is stored in $recipient_uid#


$facebook = new Facebook(APP_API_KEY,APP_SECRET_KEY);
try {
$facebook->api_client->notifications_send($recipient_uid, "has just done something nasty!");
} catch (Exception $e) {
print('notifications_sendException: ' . $e->getMessage());
}

Publish a templatized feed


$facebook = new Facebook(APP_API_KEY, APP_SECRET_KEY);
$loggedinuser = $facebook->require_login();

$title_template = '{actor} has done {param1} and {param2}!';
$title_data = json_encode(array(
'param1' => 'this',
'param2' => 'that'
));
$body_template = '{actor} {param1} {target}!';
$body_data = json_encode(array(
'param1' => 'has kissed'
));
$body_general = "Was it fun?";
$img_src = "http://yourhost.com/images/example.jpg";
$img_link = "http://an-absolute-link.com";

try {
$facebook->api_client->feed_publishTemplatizedAction(
$loggedinuser,
$title_template, $title_data,
$body_template, $body_data, $body_general,
$img_src, $img_link,
null,null,null,null,null,null,
$target_ids
);
} catch (Exception $e) {
print('feed_publishTemplatizedAction Exception: ' . $e->getMessage());
}

/*another sample code of notification

$userid = 123456789; //This can also be a comma separated list of UIDs
$facebook->api_client->notifications_send_announce($userid, 'You have just received an announcement notification! Click <a href="http://www.apps.facebook.com/appname/">here</a> to go to my application.');
*/

 /**
   * Sends an announcement notification to the application users.
   * @return (nothing)
   */
  public function &notifications_send_announce($to_ids, $notification) {
    return $this->call_method('facebook.notifications.send',
                              array('to_ids' => $to_ids, 'notification' => $notification, 'type' => 'app_to_user'));
  }

?>